<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>團購頁面-{$tpshop_config['shop_info_store_title']}</title>
<meta http-equiv="keywords" content="{$tpshop_config['shop_info_store_keyword']}" />
<meta name="description" content="{$tpshop_config['shop_info_store_desc']}" />
</head>
<style>
span.virtual_num {
    background: #fee97d linear-gradient(#fee97d 60%, #fde158 100%) repeat-x scroll 0 0;
    border-bottom: 1px solid #f9ac00;
    border-radius: 2px;
    color: #f72862;
    display: block;
    float: right;
    font-size: 20px;
    height: 23px;
    line-height: 23px;
    margin: 5px;
    padding-left: 5px;
    padding-right: 5px;
}
}
</style>
<body>
<!--------頭部開始-------------->
<include file="Public/header" />
<!--------頭部結束-------------->
<link rel="stylesheet" href="__STATIC__/css/page.css" type="text/css">
<script src="__PUBLIC__/js/pc_common.js"></script>
<link rel="stylesheet" href="__STATIC__/css/jqzoom.css" type="text/css">
<script src="__STATIC__/js/jquery.jqzoom.js"></script>  
<script src="__PUBLIC__/js/layer/layer.js"></script><!--彈窗js 參考文檔 http://layer.layui.com/-->
	<div class="layout">
    	<div class="breadcrumb-area">
        	<a href="/">首頁</a> >>
            <foreach name="navigate_goods" key="k" item="v">
                     <a  href="{:U('/Home/Goods/goodsList',array('id'=>$k))}">{$v}</a> >>
            </foreach>
            <span>{$goods.goods_name}</span>
        </div>
        <div class="layout pa-to-10">            
            <!--商品圖片輪播-->            
            <div class="left-area">
              <div class="left-area-tb">
               <div class="pro-gallery-img">
                	<div class="jqzoom"> <img id="zoomimg" src="{$goods.goods_id|goods_thum_images=400,400}" jqimg="{$goods.goods_id|goods_thum_images=800,800}" id="bigImage" width="480px" height="480px" alt=""/> </div>
               </div>
                <!-- 修改的部分-start -->
                <div class="pro-gallery-area">
					<div class="pro-gallery-nav">
	                	<a href="javascript:;" class="pro-gallery-back next-left disabled"></a>
	                	<div class="pro-gallery-thumbs">
	                        <ul class="small-pic" id="pro-gallerys" style="left: 0px;">
	                         <foreach name="goods_images_list" item="v" key="k" >
		                        <li class="small-pic-li <if condition="$k eq 0">current</if>"> 
	                            	<a href="javascript:void(0);">
	                                	<img src="{$v|get_sub_images=$v[goods_id],60,60}" data-img="{$v|get_sub_images=$v[goods_id],400,400}" data-big="{$v|get_sub_images=$v[goods_id],800,800}">
	                                </a>
	                            </li>
	                        </foreach>
	                        </ul>
	                    </div>
	                    <a href="javascript:;" class="pro-gallery-forward next-right"></a>
	                </div>
				</div>
                <!-- 修改的部分-end --> 
              </div>
            </div>   
			
            <!--商品圖片輪播 end-->        
                
            <div class="right-area-num">
                <div class="right-area">
                    <div class="right-area-le30">
                        <h1>{$goods.goods_name}</h1>
                        <div class="cpxq-explain">{$goods.goods_remark}</div>
                    </div>	
                </div>
                <div class="right-area ma-to--1">
                    <!--商品促銷 start-->	
                        <div class="bef_fo" style="font-size:14px; background-color:#f72862; color:#FFFFFF; line-height:32px; position:absolute; width:100%">
                            <p>
                              <span style="font-size:20px; padding:0px 16px 0px 26px;vertical-align:middle">團購價￥{$group_buy_info.price}</span>
                                <img class="clock_w" src="__STATIC__/images/lz.png" /><span id="surplus_text">278天 01時 58分 26秒</span>後結束
                                <span class="virtual_num">{$group_buy_info[virtual_num] + $group_buy_info[buy_num]}人已購買</span>
                             </p>
                        </div>
						<script>
                            // 倒計時
                            function GetRTime2(){
								//var text = GetRTime('2016/02/27 17:34:00');
								var text = GetRTime('{$group_buy_info.end_time|date="Y/m/d H:i:s",###}');
                                $("#surplus_text").text(text);
                            }
                            setInterval(GetRTime2,999);
                        </script>                        
                    <!--商品促銷 end-->               
                	<div class="right-area-le30 pa-3-0-0-30">
                    	
                    	<div class="pro-promotions-area">
                            <table class="promotions-tab" width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td width="60px" align="right">原&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;價：</td>
                                <td>
                                	<p class="fo-si-24 ma-le-6" style="color:#CCC">
                                    	￥<span class="fo-si-24"  id="goods_price">{$goods.shop_price}</span>
                                    </p>                                    
                                </td>
                              </tr>
                              <tr>
                                <td width="60px" align="right">商品編號：</td>
								<td>
	                                <p class=" ma-le-6">{$goods.goods_sn} <a onClick="collect_goods({$goods.goods_id});" style="color:#00F;">收藏</a></p>                      
                            <!--------用戶評價-end---------------->
                            
                                </td>
                              </tr>
                              <tr>
                                <td width="60px" align="right">商品評分：</td>
                                <td>
                                <p class="ma-le-6">
                                <span class="pf-comment"><i class="score"></i></span>
                                &nbsp;<a href=""><span>(共&nbsp;{$goods.comment_count}&nbsp;條評論)</span></a></p>
                                </td>
                              </tr>
                              <tr>
                                <td width="60px" align="right">運&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;費：</td>
                                <td><p class="ma-le-6">滿99免運費</p></td>
                              </tr>
                              <tr>
                                <td width="60px" align="right">服&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;務：</td>
                                <td><p class="ma-le-6">由tpshop商城負責發貨，並提供售後服務</p></td>
                                <td><!-- JiaThis Button BEGIN -->
                                <div class="jiathis_style">
                                    <a href="http://www.jiathis.com/share" class="jiathis jiathis_txt" target="_blank"><img src="http://v3.jiathis.com/code_mini/images/btn/v1/jiathis1.gif" border="0" /></a>
                                </div>
                                <script type="text/javascript" src="http://v3.jiathis.com/code_mini/jia.js" charset="utf-8"></script>
                                <!-- JiaThis Button END -->
                                </td>
                              </tr>
                            </table>
                        </div>
                    </div>
                </div>
                <form name="buy_goods_form" method="post" id="buy_goods_form" >
                <div class="right-area he315 ma-to--1">
                	<div class="right-area-le30 pa-3-0-0-30">
                    	<div class="pro-promotions-area">
                            <table class="promotions-tab he40-tr-td" width="100%" border="0" cellspacing="0" cellpadding="0">
                            <foreach name="filter_spec" item="v" key="k" > 
                              <tr>
                                <td width="60px" align="right">{$k}：</td>
                                <td>
                                    <ul class="choice-colol ma-le-6">
                                    <foreach name="v" item="v2" key="k2" >
                                       <if condition="$v2[src] neq ''">
                                        <li>
                                        	<div class="color-sku-fant">
                                                <div class="sku <if condition="$k2 eq 0 ">sku-bo-blo</if>">
													<a onClick="switch_spec(this)"><img src="{$v2[src]}"  onClick="$('#bigImage').attr('src','{$v2[src]}');$('#bigImage').attr('jqimg','{$v2[src]}');"/></a>
                                                    <input type="radio" style="display:none;" name="goods_spec[{$k}]" value="{$v2[item_id]}"  <if condition="$k2 eq 0 ">checked="checked"</if>   />
                                                    <s></s>
                                                </div>
												<p>{$v2[item]}</p>
                                            </div>                                            
                                        </li>
								       <else />                                        
										<li>
                                            <div class="sku  <if condition="$k2 eq 0 ">sku-bo-blo</if>">
                                                <a onClick="switch_spec(this);" class="choice-size">{$v2[item]}</a>
                                                <input type="radio"  style="display:none;" name="goods_spec[{$k}]" value="{$v2[item_id]}" <if condition="$k2 eq 0 ">checked="checked"</if>  />
                                                <s></s>
                                            </div>
                                        </li>                                        
								     </if>                                        
					                 </foreach>
                                    </ul>
                                </td>
                              </tr>
                            </foreach>   
                              <tr>
                                <td width="60px" align="right">購買數量：</td>
                                <td>
                                    <ul class="choice-colol ma-le-6">
                                        <li>
                                            <a onClick="switch_num(-1);" class="choice-number fl" title="減" style="width:24px">-</a>
                                            <input class="wi43 fl" type="text" value="1" name="goods_num" id="goods_num" readonly />
                                            <a onClick="switch_num(1);" class="choice-number fl" title="加" style="width:24px">+</a>
                                        </li>
                                    </ul>
                                </td>
                              </tr>
                              <if condition="empty($filter_spec)">
                              <tr>
                              	<td align="right" style="vertical-align:top">送&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;貨：</td>
                                <td>由TPshop商城從 全國最近點 發貨，並提供售後服務。如有問題咨詢在線客服~!<br/>上午08:30前完成下單下午送達,下午下單隔日第二天送達.</td>
                              </tr>
                              </if>
                            </table>
                        </div>
                        <div class="join-a-shopping-cart fl"><!-- location.href='{:U('Home/Cart/cart')}-->
                            <a class="jrgwc-shopping-img jrgwc-shopping-img2" onClick="javascript:AjaxAddCart({$goods.goods_id},1,1);">
                                <span>立即參團</span>
                            </a>
                    	</div>
                        <div class="join-a-shopping-cart ma-le-210 fl">
                            <a class="jrgwc-shopping-img2" onClick="javascript:AjaxAddCart({$goods.goods_id},1,0);">
                                <span>加入購物車</span>
                            </a>
                    	</div>
                    	
                    </div>
                </div>
	                <input type="hidden" name="goods_id" value="{$goods.goods_id}" />
                </form>
            </div>
        </div>
    </div>
    <div class="layout ma-to-20 ov-hi">
    	<div class="wi240 ov-hi fl">
        	<div class="product-history-area">
            	<div class="hi47 co-grey">
                	<h3 class="fl browse-his">推薦商品</h3>
                    <!--<span class="fr pa-15-16-0-0"><a class="del-dust cu-po"></a></span>-->
                </div>
                <div class="history-bott">
                	<ul class="history-comm">
                     <tpshop sql="select * from `__PREFIX__goods` where is_recommend = 1 order by goods_id desc limit 10" item="v" key="k" >    
                		<li>
                        	<div>
                        		<p class="p-img-comm fl">
                                	<a href="{:U('Home/Goods/goodsInfo',array('id'=>$v[goods_id]))}"><img class="img-comm" src="{$v.goods_id|goods_thum_images=60,60}" alt=""></a>
                                </p>
                        		<p class="p-name-comm">
                                	<a href="{:U('Home/Goods/goodsInfo',array('id'=>$v[goods_id]))}">{$v.goods_name}</a>
                                </p>
                        		<p class="p-price-comm">
                                	<b>¥{$v.shop_price}</b>
                                </p>
                        	</div>
                        </li>
                      </tpshop>
                	</ul>
                </div>                
            </div>
        </div>
    	<div class="wi940 ov-hi fr">
        	<div class="comm-param">
            	<div class="parame-title">
                	<div class="par-titles co-grey">
                    	<ul class="commodity-xq tab_li">
                    		<li class="current cliks" onClick="switch_tab(this,'tab1')">
                            	<a>商品詳情</a>
                            </li>
                            <li class="cliks" onClick="switch_tab(this,'tab2')">
                            	<a>用戶評價（{$commentStatistics['c0']}）</a>
                            </li>
                            <li class="cliks" onClick="switch_tab(this,'tab3')">
                            	<a>規格參數</a>
                            </li>
                            <li class="cliks" onClick="switch_tab(this,'tab4')">
                            	<a>售後服務</a>
                            </li>
                    	</ul>
                    </div>
                </div>
                	<!-------------------商品詳情------------------>
            	<div class="parame-bott cliks-bn" style="display:" id="tab1">
                    <div class="commodity-num pro-feature-area">                    	
                        <div class="pro-disclaimer-area ma-to-20">
							{$goods.goods_content|htmlspecialchars_decode}
                        </div>
                    </div>
                </div>
                    <!-------------------規格參數------------------>
                <div class="parame-bott cliks-bn" style="display:none"  id="tab3">
                    <div class="commodity-num pro-feature-area wi850">
                    	<table class="modity-zhut" width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <th colspan="2"><h3>商品屬性</h3></th>
                          </tr>                          
                          <foreach name="goods_attr_list" item="v" key="k" >
                          <tr>
                            <td class="wi143">{$goods_attribute[$v[attr_id]]}</td>
                            <td class="pa-5-0">{$v[attr_value]}</td>
                          </tr>                         
                          </foreach>
                        </table>
                    </div>
                </div>
                    <!-------------------售後服務------------------>
                <div class="parame-bott cliks-bn" style="display:none"  id="tab4">
                     <div class="commodity-num pro-feature-area wi850 padding36-0-36-0">
                    	<p class="fo-si-14 li-hi-1-5 fo-fa">
                        	本產品全國聯保，享受三包服務，質保期為：壹年質保
                            <br>
                            如因質量問題或故障，憑廠商維修中心或特約維修點的質量檢測證明，享受7天內退貨，15日內換貨，15日以上在質保期內享受免費保修等三包服務！
                            <br>
                            售後服務電話：400-830-8300
                            <br>
                            <span>TPshop消費者官網： <a href="">http://www.tp-shop.com</a></span>
                            <br>
                        </p>
                    </div>
                </div>
                    <!-------------------用戶評價------------------>
                <div class="parame-bott ov-hi" style="display:none"  id="tab2">
                            <div class="evaluation-top fo-fa di-in-bl">
                            	<div class="eval-le1 fl wi146 te-al">
                                	<span><b>{$commentStatistics['rate1']}</b>%</span>
                                    <em>好評度</em>
                                </div>
                            	<div class="eval-le2 fl wi123 pa-to-7">
                                	<dl>
                                		<dt>好評<em>({$commentStatistics['rate1']}%)</em></dt>
                                		<dd><s style=" width:94%"></s></dd>
                                	</dl>
                                	<dl>
                                		<dt>中評<em>({$commentStatistics['rate2']}%)</em></dt>
                                		<dd><s style=" width:2%"></s></dd>
                                	</dl>
                                	<dl>
                                		<dt>差評<em>({$commentStatistics['rate3']}%)</em></dt>
                                		<dd><s style=" width:4%"></s></dd>
                                	</dl>
                                </div>
                            	<div class="eval-le3 fl wi516">
                                	<dl>
                                		<dt>買家評論事項：購買後有什麽問題, 滿意, 或者不不滿, 都可以在這裏評論出來, 這裏評論全部源於真實的評論.</dt>
                                	</dl>
                                </div>
                            	<div class="eval-le4 fl wi150 pa-to-43 te-al">
                                	<a href="{:U('Home/User/comment')}">發表評價</a>
                                </div>
                            </div>
                            <div class="evaluation-cen fo-fa">
                            	<div class="eval-cen-le fl pa-le-12">
                                	<ul>
                                		<li class="curres cliks">
                                            <a href="javascript:void(0);" data-t='1'>
                                                <span>
                                                    全部評價
                                                    <em>({$commentStatistics['c0']})</em>
                                                </span>
                                            </a>
                                        </li>
                                        <li class="cliks">
                                            <a href="javascript:void(0);" data-t='2'>
                                                <span>
                                                    好評
                                                    <em>({$commentStatistics['c1']})</em>
                                                </span>
                                            </a>
                                        </li>
                                        <li class="cliks">
                                            <a href="javascript:void(0);" data-t='3'>
                                                <span>
                                                    中評
                                                    <em>({$commentStatistics['c2']})</em>
                                                </span>
                                            </a>
                                        </li>
                                        <li class="cliks">
                                            <a href="javascript:void(0);" data-t='4'>
                                                <span>
                                                    差評
                                                    <em>({$commentStatistics['c3']})</em>
                                                </span>
                                            </a>
                                        </li>
                                	</ul>
                                </div>
                            </div>
                            <!--------用戶評價-start--------------->
                            <!--<link rel="stylesheet" href="/Public/bootstrap/css/bootstrap.min.css" type="text/css">--->
                            <div class="evaluation-bott pa-to-25 cliks-bn" style="display:block" id="ajax_comment_return">
                            <!--ajax 然後分頁數據-->
                            </div>
							<script>
                                $(document).ready(function(){
									commentType = 1; // 評論類型
                                    ajaxComment(1,1);// ajax 加載評價列表
                                });
								
								// 好評差評 切換
								$(".eval-cen-le a").click(function(){
										$(".eval-cen-le li").removeClass('curres');	
										$(this).parent().addClass('curres');	
										commentType = $(this).data('t');// 評價類型   好評 中評  差評
										ajaxComment(commentType,1);
							    });
							    								
                                 // 用ajax分頁顯示評論
                                function ajaxComment(commentType,page){
                                        $.ajax({
                                            type : "GET",
                                            url:"/index.php?m=Home&c=goods&a=ajaxComment&goods_id={$goods['goods_id']}&commentType="+commentType+"&p="+page,//+tab,
                                            success: function(data){
                                                $("#ajax_comment_return").html('');
                                                $("#ajax_comment_return").append(data);
                                            }
                                        });
                                    }	
                            </script>	
                            <!--------用戶評價-end---------------->
                </div>
            </div>
            <div class="comm-param">
            	<div class="parame-title">
                	<div class="par-titles co-grey">
                    	<ul class="commodity-xq ask_tab_li consult_ul">
                    		<li class="current cliks">
                            	<a data-t='0'>全部咨詢</a>
                            </li>
                            <li class="cliks">
                            	<a data-t='1'>商品咨詢</a>
                            </li>
                            <li class="cliks">
                            	<a data-t='2'>支付</a>
                            </li>
                            <li class="cliks">
                            	<a data-t='3'>配送</a>
                            </li>
                            <li class="cliks">
                            	<a data-t='4'>售後</a>
                            </li>                            
                    	</ul>
                    </div>
                </div>
                <!-------------------咨詢列表----------------->
            	<div class="parame-bott cliks-bn" style="display:block" id="ask_tab1">
                    <div class="commodity-num" id="ajax_consult_return">
             		<!--ajax return-->
                    </div>
                </div>    
				<script>
                    $(document).ready(function(){
                        consult_type = 0; // 咨詢類型
                        ajaxConsult(consult_type,1);// ajax 加載咨詢列表
                    });                   
					// 咨詢類型切換
					$(".consult_ul a").click(function(){
							$(".consult_ul li").removeClass('current');	
							$(this).parent().addClass('current');	
							consult_type = $(this).data('t');// 咨詢類型 商品咨詢 支付咨詢 配送咨詢 售後咨詢
							ajaxConsult(consult_type,1);
					});
					                                                                        
                     // 用ajax分頁顯示咨詢
                    function ajaxConsult(consult_type,page){
                            $.ajax({
                                type : "GET",
                                url:"/index.php?m=Home&c=Goods&a=ajax_consult&goods_id={$goods['goods_id']}&consult_type="+consult_type+"&p="+page,//+tab,
                                success: function(data){
                                    $("#ajax_consult_return").html('');
                                    $("#ajax_consult_return").append(data);
                                }
                            });
                        }	
                </script>                
                <!-------------------咨詢列表-end---------------->                                                
                <!-------------------發表咨詢------------------>
                <div class="parame-bott ma-to--21">
                    <div class="commodity-num">
                    	<div class="spxqer-top-t">
                        	<h3 class="spxqer-topt-h3">發表咨詢</h3>
                        </div>
                        <div class="spxqer-cen">
                            <div class="spxqer-top pa-17-0-14">
                                <span class="colo-ora">溫馨提示：</span>
                                因產線可能更改商品包裝、產地、附配件等未及時通知，且每位咨詢者購買、提問時間等不同。為此，客服給到的回復僅對提問者3天內有效，其他網友僅供參考！給您帶來的不便還請諒解，謝謝！
                            </div>
                            <div class="form-edit-area">
                        		<form action="{:U('Home/Goods/goodsConsult')}" method="post" id="form_consult" name="form_consult" onSubmit="return check_form_consult(this);">
                                    <div class="form-table">
                                        <p>
                                            <b>商品咨詢：</b>
                                            <input type="radio" name="consult_type" value="1" checked /><label for="">商品咨詢</label>
                                            <input type="radio" name="consult_type" value="2" /><label for="">支付</label>
                                            <input type="radio" name="consult_type" value="3" /><label for="">配送</label>
                                            <input type="radio" name="consult_type" value="4" /><label for="">售後</label>
                                        </p>
                                        <p>網&nbsp;名:<input type="text" name="username" id="username" placeholder="請輸入網名" /></p> 
                                        <p>內&nbsp;容:<textarea name="content" id="content"  class="textarea"></textarea></p>
                                        <p>
                                            驗證碼:<input  type="text" name="verify_code" placeholder="不區分大小寫"/>
                                            <img  id="verify_code" width="80" height="40" src="/index.php?m=Home&c=Index&a=verify&type=consult&fontSize=20&length=4" />
                                            <a><img  src="__STATIC__/images/chg_image.png"  onclick="verify(this)" /></a>                                    
                                        </p>
                                    </div>                                    
                                    <div class="form-butt">
	                                    <input type="hidden" name="goods_id" id="goods_id"  value="{$goods['goods_id']}"/>
                                        <input type="submit" class="bu-tj" value="提交">                                        
                                    </div>                                
                              </form>
                        	</div>
                        </div>
                    </div>
                </div>
                <script>
						// 商品咨詢表單驗證
		                function check_form_consult(f){
							if($.trim($('input[name="username"]').val()).length == 0)
							{
								layer.msg('請填寫壹個網名', {
								  icon: 1,   // 成功圖標
								  time: 2000 //2秒關閉（如果不配置，默認是3秒）
								});			

								return false;
							}
							if($.trim($('textarea[name="content"]').val()).length == 0)
							{
								layer.msg('請填輸入咨詢內容', {
								  icon: 1,   // 成功圖標
								  time: 2000 //2秒關閉（如果不配置，默認是3秒）
								});											

								return false;
							}
							if($.trim($('input[name="verify_code"]').val()).length == 0)
							{
								layer.msg('請填輸入驗證碼', {
								  icon: 1,   // 成功圖標
								  time: 2000 //2秒關閉（如果不配置，默認是3秒）
								});																			

								return false;
							}														
								return true;							
						}
                </script>
                <!-------------------發表咨詢 end----------------->  
        </div>
    </div>
    </div>

<script>





$(document).ready(function(){
	// 更新商品價格
	get_goods_price();
    $(".jqzoom").jqueryzoom({
        xzoom: 480,
        yzoom: 480,
        offset: 30,
        position: "right",
        preload: 1,
        lens: 1
    });

});



/**
* 切換規格
*/
function switch_spec(spec)
{
	$(spec).siblings('input').trigger('click');	 // 讓隱藏的 單選按鈕選中
	$(spec).parent().parent().parent().parent().find("div.sku").removeClass('sku-bo-blo'); //   清空勾選圖標
	$(spec).parent().addClass('sku-bo-blo'); // 當前 加上勾選圖標				
	// 更新商品價格
	get_goods_price();							
}

/**
* 購買商品數量加加減減
*/
function switch_num(num)
{
	var num2 = parseInt($("#goods_num").val());
	num2 += num;
	if(num2 < 1) num2 = 1; // 保證購買數量不能少於 1
	$("#goods_num").val(num2); // 修改商品購買數量
	
	// 更新商品價格
	get_goods_price();
}
// 用作 sort 排序用
function sortNumber(a,b) 
{ 
	return a - b; 
} 
 /*** 查詢商品價格*/  
 function get_goods_price()
 {	 	 	

	var goods_price = {$goods.shop_price}; // 商品起始價
	var store_count = {$goods.store_count}; // 商品起始庫存	

	var spec_goods_price = {$spec_goods_price};  // 規格 對應 價格 庫存表   //alert(spec_goods_price['28_100']['price']);	
	// 如果有屬性選擇項
	if(spec_goods_price != null)
	{
		goods_spec_arr = new Array();
		$("input[name^='goods_spec']:checked").each(function(){
			 goods_spec_arr.push($(this).val());
		});    
		var spec_key = goods_spec_arr.sort(sortNumber).join('_');  //排序後組合成 key			
		goods_price = spec_goods_price[spec_key]['price']; // 找到對應規格的價格		
		store_count = spec_goods_price[spec_key]['store_count']; // 找到對應規格的庫存
	}
	
	var goods_num = parseInt($("#goods_num").val()); 
	// 庫存不足的情況
	if(goods_num > store_count)
	{
	   goods_num = store_count;
	   layer.msg('庫存僅剩 '+store_count+' 件', {icon: 2}); //alert('庫存僅剩 '+store_count+' 件');	   
	   $("#goods_num").val(goods_num);
	}	
	$("#goods_price").html(goods_price * goods_num); // 變動價格顯示
 }
  
/**
* 切換 商品詳情  用戶評價  規格參數  包裝清單  售後服務
*/
function switch_tab(cur,tab)
{
	$("#tab1,#tab2,#tab3,#tab4").hide(); // 先全部隱藏
	$("#"+tab).show();	// 再顯示其中壹個	
	$("ul.tab_li li").removeClass("current"); // 先全部樣式去除
	$(cur).addClass("current"); //  單獨的給當前點擊這個加上		
}
 
// 驗證碼切換
function verify(){
   $('#verify_code').attr('src','/index.php?m=Home&c=Index&a=verify&type=consult&fontSize=20&length=4&r='+Math.random());
}

//縮略圖切換
$('.small-pic-li').each(function(i,o){
	var lilength = $('.small-pic-li').length;
	$(o).hover(function(){
		$(o).siblings().removeClass('current');
		$(o).addClass('current');
		$('#zoomimg').attr('src',$(o).find('img').attr('data-img'));
		$('#zoomimg').attr('jqimg',$(o).find('img').attr('data-big'));
		if(i==0){
			$('.next-left').addClass('disabled');
		}
		if(i+1==lilength){
			$('.next-right').addClass('disabled');
		}
	});
})

//前壹張縮略圖
$('.next-left').click(function(){
	var newselect = $('.small-pic>.current').prev();
	$('.small-pic-li').removeClass('current');
	$(newselect).addClass('current');
	$('#zoomimg').attr('src',$(newselect).find('img').attr('data-img'));
	$('#zoomimg').attr('jqimg',$(newselect).find('img').attr('data-big'));
	var index = $('.small-pic>li').index(newselect);
	if(index==0){
		$('.next-left').addClass('disabled');
	}
	$('.next-right').removeClass('disabled');
})

//後前壹張縮略圖
$('.next-right').click(function(){
	var newselect = $('.small-pic>.current').next();
	$('.small-pic-li').removeClass('current');
	$(newselect).addClass('current');
	console.log(newselect)
	$('#zoomimg').attr('src',$(newselect).find('img').attr('data-img'));
	$('#zoomimg').attr('jqimg',$(newselect).find('img').attr('data-big'));
	var index = $('.small-pic>li').index(newselect);
	if(index+1 == $('.small-pic>li').length){
		$('.next-right').addClass('disabled');
	}
	$('.next-left').removeClass('disabled');
})
</script>
<!--------footer-開始-------------->
<include file="Public/footer" />
<!--------footer-結束-------------->
</body>
</html>